﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Xml.Serialization;

namespace Sovigaz.DataProvider
{
    public partial class SovigazDbContext
    {
        public DbSet<Product> Products { get; set; }
    }

    [Table("Products")]
    public class Product : AuditableEntity
    {
        public Product()
        {
            PartnerID = 1;
            OwnerID = 1;
            CategoryID = 1;
            Manufacture = "China";
            Size = "L";
            Status = "D";
            Expired = DateTime.Now;
            BoughtDate = DateTime.Now;
            CheckedDate = DateTime.Now;
            ManufacturedDate = DateTime.Now;
            AssignedDate = DateTime.Now;
            AssignedToEnterprise = "Bình Dương";
            PartnerID = 1;
            IsIndemnify = false;
        }
        [Key]
        public int ProductID { get; set; }

        public int LotID { get; set; }

        public int CategoryID { get; set; }

        public int OwnerID { get; set; }

        public int PartnerID { get; set; }

        public string Barcode { get; set; }

        public string ProductCode { get; set; }

        public string Manufacture { get; set; }

        public string Symbol { get; set; }

        public DateTime ManufacturedDate { get; set; }

        public decimal Weight { get; set; }

        public decimal Volume { get; set; }

        public string Size { get; set; }

        public decimal PressureLoad { get; set; }

        public decimal PressureTest { get; set; }

        public decimal Capacity { get; set; }

        public DateTime BoughtDate { get; set; }

        public DateTime CheckedDate { get; set; }

        public string Certify { get; set; }

        public string ChatXop { get; set; }

        public string AssignedToEnterprise { get; set; }

        public DateTime AssignedDate { get; set; }

        public DateTime Expired { get; set; }

        public string Description { get; set; }

        public bool IsEmpty { get; set; }

        public bool IsIndemnify { get; set; }

        public string Status { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<Partner> Partners { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<Lot> Lots { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<Category> Categories { get; set; }
    }

    public class ProductComplex
    {
        public int ProductID { get; set; }

        public int LotID { get; set; }

        public int CategoryID { get; set; }

        public int PartnerID { get; set; }

        public int OwnerID { get; set; }

        public string OwnerName { get; set; }

        public string CategoryName { get; set; }

        public string Barcode { get; set; }

        public string ProductCode { get; set; }

        public string Manufacture { get; set; }

        public string Symbol { get; set; }

        public decimal Weight { get; set; }

        public decimal TestWeight { get; set; }

        public decimal LostWeight { get; set; }

        public decimal TestVolume { get; set; }

        public DateTime TestedDate { get; set; }

        public decimal Volume { get; set; }

        public string Size { get; set; }

        public decimal PressureLoad { get; set; }

        public decimal PressureTest { get; set; }

        public decimal Capacity { get; set; }

        public DateTime BoughtDate { get; set; }

        public DateTime CheckedDate { get; set; }

        public string AssignedToEnterprise { get; set; }

        public DateTime AssignedDate { get; set; }

        public DateTime Expired { get; set; }

        public bool IsEmpty { get; set; }

        public string Status { get; set; }

        public bool IsDeleted { get; set; }
    }

    public enum ProductStatus
    {
        D,
        K,
        M
    }
}